package org.r13notes.activity;

import org.r13notes.R;
import org.r13notes.notes.NotesDBUserAdapter;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

/**
 * 
 * @author Lukasz Raczko
 *
 * Temporary activity used to add notes. At present I do not know how it should like in final version
 * to be nice looking and useful. So for the time being I will use this.
 */

public class TempCreateNoteActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        context = this;
        
        setContentView(R.layout.temp_addnote);
        
        Button addButton = (Button) findViewById(R.id.temp_AddNoteButton);
        addButton.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View view) {
				EditText noteEditText = (EditText) findViewById(R.id.temp_NoteEditText);
				String noteText = noteEditText.getText().toString();
				
				NotesDBUserAdapter dbAdapter = new NotesDBUserAdapter(TempCreateNoteActivity.this);
				
				dbAdapter.addNote(noteText);				
				
				finish();
			}
        	
        });
    }
    
    private Context context;
    
}
